define(['require', './PageView', '../libs/extend', 'backbone'], function (require, PageView, extend, Backbone) {
    return PageView.extend({
        Category: null,
        //initialize
        initialize: function () {

        },
        onRender: function () {
            var _this = this;
            var token = _this.params.token;
            var users = {};
            //如果token存在
            if (token) {
                users.userId = token;
                extend.setlocalStorage('YY_userInfo', users);
            } else {
                users = extend.getlocalStorage('YY_userInfo');
            }
            var indexData = {
                "pageindex": 1,
                "pagesize": 10
            };
            extend.sendData(window.app.proxy.root + 'allResearchRecords', indexData, function (res) {
                if (res.status == 'success') {
                    _this.findComponent("Category").fieldCollection.reset(res.data);
                } else {
                    extend.Toast(res.message, 2000);
                }
            }, function (e) {
                extend.Toast('网络错误', 2000);
            });
             //获取登录人信息
            extend.sendData(window.app.proxy.root + 'getMyData', users, function (res) {
                var myData = res.data;
                if (res.status == 'success') {
                    extend.setlocalStorage('YY_MyData', myData);
                } else {
                    extend.Toast(res.message, 2000);
                }
            }, function (e) {
                extend.Toast('网络错误', 2000);
            });
        }
    });
});
